<?php

/**
 * Bbsucursal form.
 *
 * @package    ingenyo-biblio
 * @subpackage form
 * @author     Your name here
 */
class CtbuscaForm extends sfForm
{

  public function configure()
  {
    //Busqueda por grupos
    $grupos = array('18' => 'Nombre del Autor', '12' => 'Apellido del Autor', '13' => 'Titulo', '14' => 'Tema');
    $op_logicos = array('1' => 'Y', '2' => 'O', '3' => 'X0R');
    $this->setWidget('selec_1', new sfWidgetFormChoice(array(
        'choices' => $grupos
      )));
    $this->setWidget('input_selec_1', new sfWidgetFormInput());
    $this->setDefault('selec_1', 18);
    $this->setWidget('logico_1', new sfWidgetFormChoice(array(
        'choices' => $op_logicos
      )));    

    $this->setWidget('selec_2', new sfWidgetFormChoice(array(
        'choices' => $grupos
      )));
    $this->setWidget('input_selec_2', new sfWidgetFormInput());
    $this->setDefault('selec_2', 12);
    $this->setWidget('logico_2', new sfWidgetFormChoice(array(
        'choices' => $op_logicos
      )));      

    $this->setWidget('selec_3', new sfWidgetFormChoice(array(
        'choices' => $grupos
      )));
    $this->setWidget('input_selec_3', new sfWidgetFormInput());
    $this->setDefault('selec_3', 13);
    $this->setWidget('logico_3', new sfWidgetFormChoice(array(
        'choices' => $op_logicos
      )));     

    $this->setWidget('selec_4', new sfWidgetFormChoice(array(
        'choices' => $grupos
      )));
    $this->setWidget('input_selec_4', new sfWidgetFormInput());
    $this->setDefault('selec_4', 14);
    
    //Busqueda por sucursal
    $sucursales = BbSucursalPeer::getSucursales();
    $sucursales[0] = 'Todos/as';
    $this->setWidget('sucursal', new sfWidgetFormChoice(array(
        'choices' => $sucursales,
      )));
    $this->setDefault('sucursal', 0);

    //Busqueda por Tipo de Documento
    $tipo_doc = CtValoresPeer::getTipificacion(4);
    $tipo_doc[0] = 'Todos/as';
    $this->setWidget('tipo_doc', new sfWidgetFormChoice(array(
        'choices' => $tipo_doc,
      )));
    $this->setDefault('tipo_doc', 0);

    //Busqueda por Formato
    $formato = CtValoresPeer::getTipificacion(5);
    $formato[0] = 'Todos/as';
    $this->setWidget('formato', new sfWidgetFormChoice(array(
        'choices' => $formato,
      )));
    $this->setDefault('formato', 0);

  }

}
